<?php
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Academic Free License (AFL 3.0)
 * that is bundled with this package in the file LICENSE_AFL.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/afl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category   design_default
 * @package    Mage_Downloadable
 * @copyright  Copyright (c) 2008 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
 */
?>
<?php
/**
 * @see Mage_Downloadable_Block_Customer_Products_List
 */
?>
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
<?php $_items = $this->getItems(); ?>
<div class="page-head">
    <h3><?php echo Mage::helper('downloadable')->__('My Downloadable Products') ?></h3>
</div>
<?php echo $this->getChildHtml('pager'); ?>
<table cellspacing="0" class="data-table" id="my-downloadable-products-table">
    <thead>
        <tr>
            <th><?php echo Mage::helper('downloadable')->__('Order #') ?></th>
            <th><?php echo Mage::helper('downloadable')->__('Date') ?></th>
            <th><?php echo Mage::helper('downloadable')->__('Title') ?></th>
            <th><?php echo Mage::helper('downloadable')->__('Status') ?></th>
            <th><?php echo Mage::helper('downloadable')->__('Remaining Downloads') ?></th>
        </tr>
    </thead>
    <tbody>
        <?php $_odd = ''; ?>
        <?php foreach ($_items as $_item): ?>
            <tr>
                <td><a href="<?php echo $this->getOrderViewUrl($_item->getPurchased()->getOrderId()) ?>" title="<?php echo Mage::helper('downloadable')->__('View Order') ?>"><?php echo $_item->getPurchased()->getOrderIncrementId() ?></a></td>
                <td><?php echo $this->formatDate($_item->getPurchased()->getCreatedAt()) ?></td>
                <td><?php echo $_item->getPurchased()->getProductName() ?> - <a href="<?php echo $this->getDownloadUrl($_item) ?>" title="<?php echo Mage::helper('downloadable')->__('Start Download') ?>" <?php echo $this->getIsOpenInNewWindow()?'onclick="this.target=\'_blank\'"':''; ?>><?php echo $_item->getLinkTitle() ?></a></td>
                <td><em><?php echo ucfirst($_item->getStatus()) ?></em></td>
                <td><?php echo $this->getRemainingDownloads($_item) ?></td>
            </tr>
        <?php endforeach; ?>
    </tbody>
</table>
<script type="text/javascript">decorateTable('my-downloadable-products-table')</script>
<?php echo $this->getChildHtml('pager'); ?>
